package points

import (
	"ferry/models/base"
)

/*
  @Author : lanyulei
*/

// 用户积分历史表
type PointsHistory struct {
	base.Model
	UserId      int    `gorm:"column:user_id; type:int(11); not null; index" json:"user_id" form:"user_id"`                   // 用户ID
	ProcessId   int    `gorm:"column:process_id; type:int(11); not null; index" json:"process_id" form:"process_id"`          // 流程ID
	WorkOrderId int    `gorm:"column:work_order_id; type:int(11); not null; index" json:"work_order_id" form:"work_order_id"` // 工单ID
	Points      int    `gorm:"column:points; type:int(11); not null" json:"points" form:"points"`                             // 获得积分数量
	Type        int    `gorm:"column:type; type:tinyint(1); not null; default:1; index" json:"type" form:"type"`              // 积分类型：1-获取积分，2-兑换商品消耗积分
	Reason      string `gorm:"column:reason; type:varchar(255)" json:"reason" form:"reason"`                                  // 积分获得原因
	ProcessName string `gorm:"column:process_name; type:varchar(128)" json:"process_name" form:"process_name"`                // 流程名称（冗余字段，便于查询）
}

func (PointsHistory) TableName() string {
	return "p_points_history"
}
